import json
from country_code import get_country_code

filename = 'eq_data/population_data.json'

# 将数据加载到列表中
with open(filename) as f:
    pop_data = json.load(f)

for pop_dict in pop_data:
    if pop_dict["Year"] == '2010':
        country_name = pop_dict['Country Name']
        population = int(float(pop_dict['Value']))
        code = get_country_code(country_name)
        if code:
            print(code + ":" + str(population))
        else:
            print('Error-' + country_name)
        print(country_name + ":" + str(population))

